import {createRouter, createWebHistory} from 'vue-router'
import EditorPage from '@/views/editorPage/index.vue'
import Layout from '@/components/Layout.vue'
import PreviewPage from '@/views/previewPage/index.vue'
import AppManage from '@/views/appManage/index.vue'
import UserManage from '@/views/userManage/index.vue'

const routes = [
    {
        path: '/',
        redirect: '/appManage',
        component: Layout,
        children: [
            {
                path: 'appManage',
                component: AppManage,
                children: [],
                meta: {
                    title: '应用管理',
                    icon: 'List',
                    appMenuShowItem: true //配置在外层菜单项上，表示此菜单项和其子代菜单栏显示在导航栏中
                }
            },
            {
                path: 'userManage',
                component: UserManage,
                children: [],
                meta: {
                    title: '用户管理',
                    icon: 'User',
                    appMenuShowItem: true //配置在外层菜单项上，表示此菜单项和其子代菜单栏显示在导航栏中
                }
            },

            {
                path: 'moduleDetail',
                component: () => import('@/views/moduleDetail/index.vue'),
                meta: {
                    title: '模型详情',
                    icon: 'EditPen',
                    appMenuShowItem: false
                }
            },
            {
                path: 'SqlEditor',//测试页面，实际使用中删除
                component: () => import('@/components/SqlEditor/index.vue'),
                meta: {
                    title: 'SQL构建器',
                    appMenuShowItem: false,
                }
            },

        ]
    },
    {
        path: '/login',
        component: () => import('@/views/login/index.vue'),
        meta: {}
    },

    {
        path: '/editor',
        name: 'Editor',
        component: EditorPage,
        meta: {}
    },
    {
        path: '/previewPage',
        name: 'PreviewPage',
        component: PreviewPage,
        meta: {}
    },

    {
        path: '/404',
        name: 'NotFound',
        component: () => import('@/views/404.vue'),
        meta: {}
    },
    {
        path: '/:pathMatch(.*)*',
        redirect: '/404',
        meta: {}
    }
] as any


const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router
